<?php
namespace App\Strategies;
use App\Helpers\DateUtils;


/**
 * Class UserIdentityStrategy
 * @package App\Strategies
 * 用户身份信息
 */
class UserIdentityStrategy extends AppStrategy
{
    /**
     * @param null $data
     * @return string
     * @desc    学历
     */
    public static function cerintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '中专/高中以下';
        elseif ($i == 2 ) return '统招大专';
        elseif ($i == 3 ) return '统考本科/自考本科';
        elseif ($i == 4 ) return '统招硕士及以上';
        else return '';
    }

    public static function cerstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '中专/高中以下') return 1;
        elseif ($str == '统招大专') return 2;
        elseif ($str == '统考本科/自考本科') return 3;
        elseif ($str == '统招硕士及以上') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    单位性质
     */
    public static function comintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '国有企业/事业单位/政府机关';
        elseif ($i == 2 ) return '合资企业';
        elseif ($i == 3 ) return '外资企业';
        elseif ($i == 4 ) return '民营企业/个体工商户';
        else return '';
    }

    public static function comstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '国有企业/事业单位/政府机关') return 1;
        elseif ($str == '合资企业') return 2;
        elseif ($str == '外资企业') return 3;
        elseif ($str == '民营企业/个体工商户') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    工作年限
     */
    public static function workintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '少于6个月';
        elseif ($i == 2 ) return '6~12个月';
        elseif ($i == 3 ) return '12~24个月';
        elseif ($i == 4 ) return '24个月以上';
        else return '';
    }

    public static function workstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '少于6个月') return 1;
        elseif ($str == '6~12个月') return 2;
        elseif ($str == '12~24个月') return 3;
        elseif ($str == '24个月以上') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    企业邮箱
     */
    public static function emailintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function emailstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    月收入
     */
    public static function monintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '5000以下';
        elseif ($i == 2 ) return '5000~8000';
        elseif ($i == 3 ) return '8001~10000';
        elseif ($i == 4 ) return '10000以上';
        else return '';
    }

    public static function  monstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '5000以下') return 1;
        elseif ($str == '5000~8000') return 2;
        elseif ($str == '8001~10000') return 3;
        elseif ($str == '10000以上') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    工资流水
     */
    public static function wageintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function wagestrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    学业信息
     */
    public static function stuintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '中专/高中及以下在读';
        elseif ($i == 2 ) return '大专在读';
        elseif ($i == 3 ) return '本科在读';
        elseif ($i == 4 ) return '硕士及以上在读';
        else return '';
    }

    public static function stustrToInt($data = '')
    {
        $str = trim($data);
        if($str == '中专/高中及以下在读') return 1;
        elseif ($str == '大专在读') return 2;
        elseif ($str == '本科在读') return 3;
        elseif ($str == '硕士及以上在读') return 4;
        else return 0;
    }


    /**
     * @param null $data
     * @return string
     * @desc    毕业年份
     */
    public static function graintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '余1年';
        elseif ($i == 2 ) return '余2年';
        elseif ($i == 3 ) return '余3年';
        elseif ($i == 4 ) return '余4年';
        else return '';
    }

    public static function grastrToInt($data = '')
    {
        $str = trim($data);
        if($str == '余1年') return 1;
        elseif ($str == '余2年') return 2;
        elseif ($str == '余3年') return 3;
        elseif ($str == '余4年') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    公司经营年限
     */
    public static function manintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '少于6个月';
        elseif ($i == 2 ) return '6~12个月';
        elseif ($i == 3 ) return '12~24个月';
        elseif ($i == 4 ) return '24个月以上';
        else return '';
    }

    public static function manstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '少于6个月') return 1;
        elseif ($str == '6~12个月') return 2;
        elseif ($str == '12~24个月') return 3;
        elseif ($str == '24个月以上') return 4;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    营业执照
     */
    public static function busiintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function busistrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    收入来源
     */
    public static function incomeintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function incomestrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    近6个月对公账户流水
     */
    public static function billintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function  billstrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

    /**
     * @param null $data
     * @return string
     * @desc    稳定的收入来源
     */
    public static function sourceintToStr($data = null)
    {
        $i = DateUtils::toInt($data);
        if($i == 1)  return '无';
        elseif ($i == 2 ) return '有';
        else return '';
    }

    public static function  sourcestrToInt($data = '')
    {
        $str = trim($data);
        if($str == '无') return 1;
        elseif ($str == '有') return 2;
        else return 0;
    }

}